<?php
/**
 * PHPSession class definition
 *   
 * @author Sean Crystal <seancrystal@gmail.com>
 * @package MVP-PHP
 */
require_once 'interfaces/iSession.php';

/**
 * Defines an application session using the built-in PHP $_SESSION
 * @package MVP-PHP
 * @subpackage Base
 */   
class PHPSession implements iSession
{
	/**
     * Set a value in the session
	 * @param string $key
	 * @param mixed $obj
	 */   	
	public function Set($key, $obj) 
	{	
		$_SESSION[$key] = serialize($obj); 
	}

	/**
     * Get a value from the session
	 * @param string $key
	 * @return mixed 
	 */  	
	public function Get($key) 
	{ 
		return unserialize($_SESSION[$key]); 
	}

	/**
 	 * See if the session contains an item
	 * @param string $key
	 * @return bool
	 */   	
	public function Contains($key) 
	{ 
		return array_key_exists($key, $_SESSION); 
	}

	/**
     * Remove a value from the session
	 * @param string $key
	 */  	
	public function Remove($key) 
	{	
		unset($_SESSION[$key]);	
	}
}

?>
